#include <iostream>
#include<vector>
using namespace std;

int main() {
	vector<int> bottle;
	vector<int> drink;
	int num;
	while (cin >> num) {
		if (num == 0)
			break;
		bottle.push_back(num);
		drink.push_back(0);
	}
	int index = 0;
	for (auto& item : bottle) {
		int count = 0;
		while (item >= 2) {
			if (item == 2) {
				count += 1;
				break;
			}
			item -= 3;
			count += 1;
			item += 1;
		}
		drink[index++] = count;
	}
	for (auto& count : drink)
		cout << count << endl;
}
